{layout name="passport:main" /}
<table class="table">
<thead>
    <tr>
        <th class="w100">操作</th>
        <th>应用名称</th>
        <th class="w150 fn-tar">应用支持</th>
        <th class="w80 fn-tac">状态</th>
    </tr>
</thead>
<tbody>
{foreach $list as $rs}
    <tr>
        <td>
            <a href="javascript:;" class="select button" title="选择" data-id="{$rs.id}"><i class="iconfont icon-text_icon"></i>选择</a>
        </td>
        <td>{$rs.appname}</td>
        <td class="fn-tar">
            {switch $rs.miniapp.types}
            {case mp}<span class="badge bg-yellow">公众号</span>{/case}
            {case program}<span class="badge bg-yellow">小程序</span>{/case}
            {case app}<span class="badge bg-yellow">APP</span>{/case}
            {case mp_program}<span class="badge bg-yellow">小程序/公众号</span>{/case}
            {case mp_program_app}<span class="badge bg-yellow">小程序/公众号/APP</span>{/case}
            {default /}<span class="badge">应用异常</span>
            {/switch}   
         </td>
        <td class="fn-tac">
            {if $rs.is_lock}
                <span class="badge bg-red">锁定</span>
            {else}
                {if $rs.miniapp.is_openapp == 0}
                    {if $rs.miniapp.template_id > $rs.order.update_var}
                        <a href="{:url('system/passport.setting/code',['id'=>$rs->id,'types'=>'program'])}"><span class="badge bg-red">请升级</span></a>
                    {else}
                    <span class="badge">正常</span>
                    {/if}  
                {else}
                    <span class="badge">正常</span>
                {/if}
            {/if}
            </td>
    </tr>
{/foreach}
</tbody>
</table>
<script type="text/javascript">
    Do('base','layer',function(){
        var index = parent.layer.getFrameIndex(window.name);
        $('.select').click(function(){
            var order_id = $(this).attr('data-id');
            parent.$("#iframe").contents().find("#{$input}").val(order_id);  
            parent.layer.close(index); 
        });
    })
</script>